<template>
  <div class="home">
    <!-- <img alt="Vue logo" src="../assets/logo.png">
      <HelloWorld msg="Welcome to Your Vue.js App"/> -->
    <Content :data="data" />
    <Btn :obj="obj" :event="action" @e-child="acceptSon" :parentName.sync="name" />
    {{name}}
  </div>
</template>

<script>
import Content from "../../views/Content.vue";
import Btn from "./Btn.vue";
export default {
  name: "stof",
  components: {
    Content,
    Btn,
  },
  data() {
    return {
      name:"parent",
      obj: {
        color: "green",
        title: "父子",
      },
      data: [{ name: 1 }, { name: 2 }, { name: 3 }, { name: 4 }],
    };
  },
  methods: {
    acceptSon(fun) {
      // 收到子组件传的父组件的方法
      fun();
    },

    action() {
      this.name = "父组件的值"
    }
  }
};
</script>
